<!doctype html>



  


<html class="theme-next muse use-motion" lang="zh-Hans">
<head>
  <meta charset="UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"/>






<meta http-equiv="Cache-Control" content="no-transform" />
<meta http-equiv="Cache-Control" content="no-siteapp" />















  
  
  <link href="/lib/fancybox/source/jquery.fancybox.css?v=2.1.5" rel="stylesheet" type="text/css" />




  
  
  
  

  
    
    
  

  

  

  

  

  
    
    
    <link href="//fonts.googleapis.com/css?family=Lato:300,300italic,400,400italic,700,700italic&subset=latin,latin-ext" rel="stylesheet" type="text/css">
  






<link href="/lib/font-awesome/css/font-awesome.min.css?v=4.6.2" rel="stylesheet" type="text/css" />

<link href="/css/main.css?v=5.1.1" rel="stylesheet" type="text/css" />


  <meta name="keywords" content="Linux," />








  <link rel="shortcut icon" type="image/x-icon" href="/favicon.ico?v=5.1.1" />






<meta name="description" content="LINUX 目录结构装完Linux，首先需要弄清Linux 标准目录结构/  root —?启动Linux时使用的一些核心文件。如操作系统内核、引导程序Grub等。 home —?存储普通用户的个人文件 ftp — 用户所有服务 httpd samba user1 user2   bin —?系统启动时需要的执行文件（二进制） sbin —?可执行程序的目录，但大多存放涉及系统管理的命令。只有ro">
<meta name="keywords" content="Linux">
<meta property="og:type" content="article">
<meta property="og:title" content="LINUX 目录结构">
<meta property="og:url" content="http://yoursite.com/2017/06/08/Linuxtree/index.html">
<meta property="og:site_name" content="韩月">
<meta property="og:description" content="LINUX 目录结构装完Linux，首先需要弄清Linux 标准目录结构/  root —?启动Linux时使用的一些核心文件。如操作系统内核、引导程序Grub等。 home —?存储普通用户的个人文件 ftp — 用户所有服务 httpd samba user1 user2   bin —?系统启动时需要的执行文件（二进制） sbin —?可执行程序的目录，但大多存放涉及系统管理的命令。只有ro">
<meta property="og:image" content="http://www.daniubiji.cn/wp-content/uploads/2015/02/06095713-85c1021200224bcc8c5ff0f2275260c5.png">
<meta property="og:updated_time" content="2017-06-30T03:36:21.000Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="LINUX 目录结构">
<meta name="twitter:description" content="LINUX 目录结构装完Linux，首先需要弄清Linux 标准目录结构/  root —?启动Linux时使用的一些核心文件。如操作系统内核、引导程序Grub等。 home —?存储普通用户的个人文件 ftp — 用户所有服务 httpd samba user1 user2   bin —?系统启动时需要的执行文件（二进制） sbin —?可执行程序的目录，但大多存放涉及系统管理的命令。只有ro">
<meta name="twitter:image" content="http://www.daniubiji.cn/wp-content/uploads/2015/02/06095713-85c1021200224bcc8c5ff0f2275260c5.png">



<script type="text/javascript" id="hexo.configurations">
  var NexT = window.NexT || {};
  var CONFIG = {
    root: '/',
    scheme: 'Muse',
    sidebar: {"position":"left","display":"post","offset":12,"offset_float":0,"b2t":false,"scrollpercent":false},
    fancybox: true,
    motion: true,
    duoshuo: {
      userId: '0',
      author: '博主'
    },
    algolia: {
      applicationID: '',
      apiKey: '',
      indexName: '',
      hits: {"per_page":10},
      labels: {"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}
    }
  };
</script>



  <link rel="canonical" href="http://yoursite.com/2017/06/08/Linuxtree/"/>





  <title>LINUX 目录结构 | 韩月</title>
</head>

<body itemscope itemtype="http://schema.org/WebPage" lang="zh-Hans">

  





  <script type="text/javascript">
    var _hmt = _hmt || [];
    (function() {
      var hm = document.createElement("script");
      hm.src = "https://hm.baidu.com/hm.js?29caf0cef6e0beec50a83c0dcae17a3b";
      var s = document.getElementsByTagName("script")[0];
      s.parentNode.insertBefore(hm, s);
    })();
  </script>










  
  
    
  

  <div class="container sidebar-position-left page-post-detail ">
    <div class="headband"></div>

    <header id="header" class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-wrapper">
  <div class="site-meta ">
    

    <div class="custom-logo-site-title">
      <a href="/"  class="brand" rel="start">
        <span class="logo-line-before"><i></i></span>
        <span class="site-title">韩月</span>
        <span class="logo-line-after"><i></i></span>
      </a>
    </div>
      
        <p class="site-subtitle"></p>
      
  </div>

  <div class="site-nav-toggle">
    <button>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
    </button>
  </div>
</div>

<nav class="site-nav">
  

  
    <ul id="menu" class="menu">
      
        
        <li class="menu-item menu-item-home">
          <a href="/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-home"></i> <br />
            
            首页
          </a>
        </li>
      
        
        <li class="menu-item menu-item-categories">
          <a href="/categories" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-th"></i> <br />
            
            分类
          </a>
        </li>
      
        
        <li class="menu-item menu-item-test">
          <a href="/test" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-eye"></i> <br />
            
            测试
          </a>
        </li>
      
        
        <li class="menu-item menu-item-menus">
          <a href="/menus" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-bars"></i> <br />
            
            菜单
          </a>
        </li>
      
        
        <li class="menu-item menu-item-archives">
          <a href="/archives" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-archive"></i> <br />
            
            归档
          </a>
        </li>
      
        
        <li class="menu-item menu-item-tags">
          <a href="/tags" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-tags"></i> <br />
            
            标签
          </a>
        </li>
      

      
    </ul>
  

  
</nav>



 </div>
    </header>

    <main id="main" class="main">
      <div class="main-inner">
        <div class="content-wrap">
          <div id="content" class="content">
            

  <div id="posts" class="posts-expand">
    

  

  
  
  

  <article class="post post-type-normal " itemscope itemtype="http://schema.org/Article">
    <link itemprop="mainEntityOfPage" href="http://yoursite.com/2017/06/08/Linuxtree/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="name" content="韩月">
      <meta itemprop="description" content="">
      <meta itemprop="image" content="/uploads/avatars.gif">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="韩月">
    </span>

    
      <header class="post-header">

        
        
          <h1 class="post-title" itemprop="name headline">
            
            
              
                LINUX 目录结构
              
            
          </h1>
        

        <div class="post-meta">
          <span class="post-time">
            
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              
                <span class="post-meta-item-text">发表于</span>
              
              <time title="创建于" itemprop="dateCreated datePublished" datetime="2017-06-08T01:35:04+08:00">
                2017-06-08
              </time>
            

            

            
          </span>

          

          
            
              <span class="post-comments-count">
                <span class="post-meta-divider">|</span>
                <span class="post-meta-item-icon">
                  <i class="fa fa-comment-o"></i>
                </span>
                <a href="/2017/06/08/Linuxtree/#comments" itemprop="discussionUrl">
                  <span class="post-comments-count disqus-comment-count"
                        data-disqus-identifier="2017/06/08/Linuxtree/" itemprop="commentCount"></span>
                </a>
              </span>
            
          

          
          
             <span id="/2017/06/08/Linuxtree/" class="leancloud_visitors" data-flag-title="LINUX 目录结构">
               <span class="post-meta-divider">|</span>
               <span class="post-meta-item-icon">
                 <i class="fa fa-eye"></i>
               </span>
               
                 <span class="post-meta-item-text">阅读次数 </span>
               
                 <span class="leancloud-visitors-count"></span>
             </span>
          

          

          

          

        </div>
      </header>
    

    <div class="post-body" itemprop="articleBody">

      
      

      
        <h1 id="LINUX-目录结构"><a href="#LINUX-目录结构" class="headerlink" title="LINUX 目录结构"></a>LINUX 目录结构</h1><p>装完Linux，首先需要弄清Linux 标准目录结构<br><img src="http://www.daniubiji.cn/wp-content/uploads/2015/02/06095713-85c1021200224bcc8c5ff0f2275260c5.png" alt=""><br>/</p>
<ul>
<li>root —?启动Linux时使用的一些核心文件。如操作系统内核、引导程序Grub等。</li>
<li>home —?存储普通用户的个人文件</li>
<li>ftp — 用户所有服务<ul>
<li>httpd</li>
<li>samba</li>
<li>user1</li>
<li>user2</li>
</ul>
</li>
<li>bin —?系统启动时需要的执行文件（二进制）</li>
<li>sbin —?可执行程序的目录，但大多存放涉及系统管理的命令。只有root权限才能执行</li>
<li>proc — 虚拟，存在linux内核镜像；保存所有内核参数以及系统配置信息<ul>
<li>1 — 进程编号</li>
</ul>
</li>
<li>usr — 用户目录，存放用户级的文件<ul>
<li>bin — 几乎所有用户所用命令，另外存在与/bin，/usr/local/bin</li>
<li>sbin — 系统管理员命令，与用户相关，例如，大部分服务器程序</li>
<li>include —??存放C/C++头文件的目录</li>
<li>lib — 固定的程序数据</li>
<li>local — 本地安装软件保存位置</li>
<li>man — 手工生成的目录</li>
<li>info — 信息文档</li>
<li>doc — 不同包文档信息</li>
<li>tmp</li>
<li>X11R6 —??该目录用于保存运行X-Window所需的所有文件。该目录中还包含用于运行GUI要的配置文件和二进制文件。</li>
<li>X386　— 功能同X11R6，X11 发行版5 的系统文件</li>
</ul>
</li>
<li>boot — 引导加载器所需文件，系统所需图片保存于此</li>
<li>lib —?根文件系统目录下程序和核心模块的公共库<ul>
<li>modules — 可加载模块，系统崩溃后重启所需模块</li>
</ul>
</li>
<li>dev —?设备文件目录</li>
<li>etc — 配置文件<ul>
<li>skel — home目录建立，该目录初始化</li>
<li>sysconfig — 网络，时间，键盘等配置目录</li>
</ul>
</li>
<li>var<ul>
<li>file</li>
<li>lib — 该目录下的文件在系统运行时，会改变</li>
<li>local — 安装在/usr/local的程序数据，变化的</li>
<li>lock — 文件使用特定外设或文件，为其上锁，其他文件暂时不能访问</li>
<li>log — 记录日志</li>
<li>run — 系统运行合法信息</li>
<li>spool —?打印机、邮件、代理服务器等假脱机目录</li>
<li>tmp</li>
<li>catman — 缓存目录</li>
</ul>
</li>
<li>mnt —?临时用于挂载文件系统的地方。一般情况下这个目录是空的，而在我们将要挂载分区时在这个目录下建立目录，再将我们将要访问的设备挂载在这个目录上，这样我们就可访问文件了。</li>
<li>tmp — 临时文件目录，系统启动后的临时文件存放在/var/tmp</li>
<li>lost+found — 在文件系统修复时恢复的文件</li>
</ul>
<h1 id="："><a href="#：" class="headerlink" title="/："></a>/：</h1><p>根目录，一般根目录下只存放目录，不要存放文件，/etc、/bin、/dev、/lib、/sbin应该和根目录放置在一个分区中</p>
<h1 id="bin-usr-bin"><a href="#bin-usr-bin" class="headerlink" title="/bin:/usr/bin:"></a>/bin:/usr/bin:</h1><p>可执行二进制文件的目录，如常用的命令ls、tar、mv、cat等。</p>
<h1 id="boot："><a href="#boot：" class="headerlink" title="/boot："></a>/boot：</h1><p>放置linux系统启动时用到的一些文件。/boot/vmlinuz为linux的内核文件，以及/boot/gurb。建议单独分区，分区大小100M即可</p>
<h1 id="dev："><a href="#dev：" class="headerlink" title="/dev："></a>/dev：</h1><p>存放linux系统下的设备文件，访问该目录下某个文件，相当于访问某个设备，常用的是挂载光驱mount /dev/cdrom /mnt。</p>
<h1 id="etc："><a href="#etc：" class="headerlink" title="/etc："></a>/etc：</h1><p>系统配置文件存放的目录，不建议在此目录下存放可执行文件，重要的配置文件有/etc/inittab、/etc/fstab、/etc/init.d、/etc/X11、/etc/sysconfig、/etc/xinetd.d修改配置文件之前记得备份。</p>
<p>注：/etc/X11存放与x windows有关的设置。</p>
<h1 id="home："><a href="#home：" class="headerlink" title="/home："></a>/home：</h1><p>系统默认的用户家目录，新增用户账号时，用户的家目录都存放在此目录下，~表示当前用户的家目录，~test表示用户test的家目录。建议单独分区，并设置较大的磁盘空间，方便用户存放数据</p>
<p>/lib:/usr/lib:/usr/local/lib：系统使用的函数库的目录，程序在执行过程中，需要调用一些额外的参数时需要函数库的协助，比较重要的目录为/lib/modules。</p>
<h1 id="lost-fount："><a href="#lost-fount：" class="headerlink" title="/lost+fount："></a>/lost+fount：</h1><p>系统异常产生错误时，会将一些遗失的片段放置于此目录下，通常这个目录会自动出现在装置目录下。如加载硬盘于/disk 中，此目录下就会自动产生目录/disk/lost+found</p>
<h1 id="mnt-media："><a href="#mnt-media：" class="headerlink" title="/mnt:/media："></a>/mnt:/media：</h1><p>光盘默认挂载点，通常光盘挂载于/mnt/cdrom下，也不一定，可以选择任意位置进行挂载。</p>
<h1 id="opt："><a href="#opt：" class="headerlink" title="/opt："></a>/opt：</h1><p>给主机额外安装软件所摆放的目录。如：FC4使用的Fedora 社群开发软件，如果想要自行安装新的KDE 桌面软件，可以将该软件安装在该目录下。以前的 Linux 系统中，习惯放置在 /usr/local 目录下</p>
<h1 id="proc："><a href="#proc：" class="headerlink" title="/proc："></a>/proc：</h1><p>此目录的数据都在内存中，如系统核心，外部设备，网络状态，由于数据都存放于内存中，所以不占用磁盘空间，比较重要的目录有/proc/cpuinfo、/proc/interrupts、/proc/dma、/proc/ioports、/proc/net/*等</p>
<h1 id="root："><a href="#root：" class="headerlink" title="/root："></a>/root：</h1><p>系统管理员root的家目录，系统第一个启动的分区为/，所以最好将/root和/放置在一个分区下。</p>
<h1 id="sbin-usr-sbin-usr-local-sbin："><a href="#sbin-usr-sbin-usr-local-sbin：" class="headerlink" title="/sbin:/usr/sbin:/usr/local/sbin："></a>/sbin:/usr/sbin:/usr/local/sbin：</h1><p>放置系统管理员使用的可执行命令，如fdisk、shutdown、mount等。与/bin不同的是，这几个目录是给系统管理员root使用的命令，一般用户只能”查看”而不能设置和使用。</p>
<h1 id="tmp："><a href="#tmp：" class="headerlink" title="/tmp："></a>/tmp：</h1><p>一般用户或正在执行的程序临时存放文件的目录,任何人都可以访问,重要数据不可放置在此目录下</p>
<h1 id="srv："><a href="#srv：" class="headerlink" title="/srv："></a>/srv：</h1><p>服务启动之后需要访问的数据目录，如www服务需要访问的网页数据存放在/srv/www内</p>
<h1 id="usr："><a href="#usr：" class="headerlink" title="/usr："></a>/usr：</h1><p>应用程序存放目录，/usr/bin存放应用程序，/usr/share存放共享数据，/usr/lib存放不能直接运行的，却是许多程序运行所必需的一些函数库文件。/usr/local:存放软件升级包。/usr/share/doc:系统说明文件存放目录。/usr/share/man:?程序说明文件存放目录，使用 man ls时会查询/usr/share/man/man1/ls.1.gz的内容建议单独分区，设置较大的磁盘空间</p>
<h1 id="var："><a href="#var：" class="headerlink" title="/var："></a>/var：</h1><p>放置系统执行过程中经常变化的文件，如随时更改的日志文件/var/log，/var/log/message：所有的登录文件存放目录，/var/spool/mail：邮件存放的目录，/var/run:程序或服务启动后，其PID存放在该目录下。建议单独分区，设置较大的磁盘空间</p>

      
    </div>

    <div>
      
        

      
    </div>

    <div>
      
        
  <div style="padding: 10px 0; margin: 20px auto; width: 90%; text-align: center;">
    <div>坚持原创技术分享，您的支持将鼓励我继续创作！</div>
    <button id="rewardButton" disable="enable" onclick="var qr = document.getElementById('QR'); if (qr.style.display === 'none') {qr.style.display='block';} else {qr.style.display='none'}">
      <span>赏</span>
    </button>
    <div id="QR" style="display: none;">
      
        <div id="wechat" style="display: inline-block">
          <img id="wechat_qr" src="/uploads/weixin.jpg" alt="韩月 WeChat Pay"/>
          <p>微信打赏</p>
        </div>
      
      
        <div id="alipay" style="display: inline-block">
          <img id="alipay_qr" src="/uploads/zhiply.jpg" alt="韩月 Alipay"/>
          <p>支付宝打赏</p>
        </div>
      
    </div>
  </div>


      
    </div>

    <div>
      
        

      
    </div>

    <footer class="post-footer">
      
        <div class="post-tags">
          
            <a href="/tags/Linux/" rel="tag"># Linux</a>
          
        </div>
      

      
        
      

      
        <div class="post-nav">
          <div class="post-nav-next post-nav-item">
            
              <a href="/2017/06/08/phplore/" rel="next" title="php必须掌握的基础知识">
                <i class="fa fa-chevron-left"></i> php必须掌握的基础知识
              </a>
            
          </div>

          <span class="post-nav-divider"></span>

          <div class="post-nav-prev post-nav-item">
            
              <a href="/2017/06/08/LinuxLine/" rel="prev" title="LINUX中常用操作命令">
                LINUX中常用操作命令 <i class="fa fa-chevron-right"></i>
              </a>
            
          </div>
        </div>
      

      
      
    </footer>
  </article>



    <div class="post-spread">
      
    </div>
  </div>


          </div>
          


          
  <div class="comments" id="comments">
    
      <div id="disqus_thread">
        <noscript>
          Please enable JavaScript to view the
          <a href="https://disqus.com/?ref_noscript">comments powered by Disqus.</a>
        </noscript>
      </div>
    
  </div>


        </div>
        
          
  
  <div class="sidebar-toggle">
    <div class="sidebar-toggle-line-wrap">
      <span class="sidebar-toggle-line sidebar-toggle-line-first"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-middle"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-last"></span>
    </div>
  </div>

  <aside id="sidebar" class="sidebar">
    <div class="sidebar-inner">

      

      
        <ul class="sidebar-nav motion-element">
          <li class="sidebar-nav-toc sidebar-nav-active" data-target="post-toc-wrap" >
            文章目录
          </li>
          <li class="sidebar-nav-overview" data-target="site-overview">
            站点概览
          </li>
        </ul>
      

      <section class="site-overview sidebar-panel">
        <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
          <img class="site-author-image" itemprop="image"
               src="/uploads/avatars.gif"
               alt="韩月" />
          <p class="site-author-name" itemprop="name">韩月</p>
           
              <p class="site-description motion-element" itemprop="description">饮食习惯：酸辣甜、不能吃冷食喝凉水,会拉肚子。<br/>身材秘诀：吃得多，拉得也多。 <br>休闲嗜好：摄影、上网、睡觉、看恐怖惊悚片（我热爱科学，不惧鬼神）、发呆、流浪（更喜欢心在旅行，喜欢一人上路的洒脱、喜欢坐在热闹的集市看人来人往</p>
          
        </div>
        <nav class="site-state motion-element">

          
            <div class="site-state-item site-state-posts">
              <a href="/archives">
                <span class="site-state-item-count">15</span>
                <span class="site-state-item-name">日志</span>
              </a>
            </div>
          

          

          
            
            
            <div class="site-state-item site-state-tags">
              
                <span class="site-state-item-count">18</span>
                <span class="site-state-item-name">标签</span>
              
            </div>
          

        </nav>

        

        <div class="links-of-author motion-element">
          
            
              <span class="links-of-author-item">
                <a href="https://github.com/aidieq" target="_blank" title="GitHub">
                  
                    <i class="fa fa-fw fa-github"></i>
                  
                  GitHub
                </a>
              </span>
            
              <span class="links-of-author-item">
                <a href="http://weibo.com/your-user-name" target="_blank" title="微博">
                  
                    <i class="fa fa-fw fa-globe"></i>
                  
                  微博
                </a>
              </span>
            
          
        </div>

        
        

        
        

        


      </section>

      
      <!--noindex-->
        <section class="post-toc-wrap motion-element sidebar-panel sidebar-panel-active">
          <div class="post-toc">

            
              
            

            
              <div class="post-toc-content"><ol class="nav"><li class="nav-item nav-level-1"><a class="nav-link" href="#LINUX-目录结构"><span class="nav-number">1.</span> <span class="nav-text">LINUX 目录结构</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#："><span class="nav-number">2.</span> <span class="nav-text">/：</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#bin-usr-bin"><span class="nav-number">3.</span> <span class="nav-text">/bin:/usr/bin:</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#boot："><span class="nav-number">4.</span> <span class="nav-text">/boot：</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#dev："><span class="nav-number">5.</span> <span class="nav-text">/dev：</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#etc："><span class="nav-number">6.</span> <span class="nav-text">/etc：</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#home："><span class="nav-number">7.</span> <span class="nav-text">/home：</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#lost-fount："><span class="nav-number">8.</span> <span class="nav-text">/lost+fount：</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#mnt-media："><span class="nav-number">9.</span> <span class="nav-text">/mnt:/media：</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#opt："><span class="nav-number">10.</span> <span class="nav-text">/opt：</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#proc："><span class="nav-number">11.</span> <span class="nav-text">/proc：</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#root："><span class="nav-number">12.</span> <span class="nav-text">/root：</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#sbin-usr-sbin-usr-local-sbin："><span class="nav-number">13.</span> <span class="nav-text">/sbin:/usr/sbin:/usr/local/sbin：</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#tmp："><span class="nav-number">14.</span> <span class="nav-text">/tmp：</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#srv："><span class="nav-number">15.</span> <span class="nav-text">/srv：</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#usr："><span class="nav-number">16.</span> <span class="nav-text">/usr：</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#var："><span class="nav-number">17.</span> <span class="nav-text">/var：</span></a></li></ol></div>
            

          </div>
        </section>
      <!--/noindex-->
      

      

    </div>
  </aside>


        
      </div>
    </main>

    <footer id="footer" class="footer">
      <div class="footer-inner">
        <div class="copyright" >
  
  &copy;  2013 - 
  <span itemprop="copyrightYear">2017</span>
  <span class="with-love">
    <i class="fa fa-heart"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">韩月</span>
</div>


<div class="powered-by">
  由 <a class="theme-link" href="https://hexo.io">Hexo</a> 强力驱动
</div>

<div class="theme-info">
  主题 -
  <a class="theme-link" href="https://github.com/iissnan/hexo-theme-next">
    NexT.Muse
  </a>
</div>


        

        
      </div>
    </footer>

    
      <div class="back-to-top">
        <i class="fa fa-arrow-up"></i>
        
      </div>
    

  </div>

  

<script type="text/javascript">
  if (Object.prototype.toString.call(window.Promise) !== '[object Function]') {
    window.Promise = null;
  }
</script>









  












  
  <script type="text/javascript" src="/lib/jquery/index.js?v=2.1.3"></script>

  
  <script type="text/javascript" src="/lib/fastclick/lib/fastclick.min.js?v=1.0.6"></script>

  
  <script type="text/javascript" src="/lib/jquery_lazyload/jquery.lazyload.js?v=1.9.7"></script>

  
  <script type="text/javascript" src="/lib/velocity/velocity.min.js?v=1.2.1"></script>

  
  <script type="text/javascript" src="/lib/velocity/velocity.ui.min.js?v=1.2.1"></script>

  
  <script type="text/javascript" src="/lib/fancybox/source/jquery.fancybox.pack.js?v=2.1.5"></script>


  


  <script type="text/javascript" src="/js/src/utils.js?v=5.1.1"></script>

  <script type="text/javascript" src="/js/src/motion.js?v=5.1.1"></script>



  
  

  
  <script type="text/javascript" src="/js/src/scrollspy.js?v=5.1.1"></script>
<script type="text/javascript" src="/js/src/post-details.js?v=5.1.1"></script>



  


  <script type="text/javascript" src="/js/src/bootstrap.js?v=5.1.1"></script>



  


  

    
      <script id="dsq-count-scr" src="https://.disqus.com/count.js" async></script>
    

    
      <script type="text/javascript">
        var disqus_config = function () {
          this.page.url = 'http://yoursite.com/2017/06/08/Linuxtree/';
          this.page.identifier = '2017/06/08/Linuxtree/';
          this.page.title = 'LINUX 目录结构';
        };
        var d = document, s = d.createElement('script');
        s.src = 'https://.disqus.com/embed.js';
        s.setAttribute('data-timestamp', '' + +new Date());
        (d.head || d.body).appendChild(s);
      </script>
    

  




	





  





  





  






  





  

  
  <script src="https://cdn1.lncld.net/static/js/av-core-mini-0.6.1.js"></script>
  <script>AV.initialize("NKTDaSdUhTnAkDGbSDu7T9Vc-gzGzoHsz", "Q6OLnPhXA67rwYezNFkthzAw");</script>
  <script>
    function showTime(Counter) {
      var query = new AV.Query(Counter);
      var entries = [];
      var $visitors = $(".leancloud_visitors");

      $visitors.each(function () {
        entries.push( $(this).attr("id").trim() );
      });

      query.containedIn('url', entries);
      query.find()
        .done(function (results) {
          var COUNT_CONTAINER_REF = '.leancloud-visitors-count';

          if (results.length === 0) {
            $visitors.find(COUNT_CONTAINER_REF).text(0);
            return;
          }

          for (var i = 0; i < results.length; i++) {
            var item = results[i];
            var url = item.get('url');
            var time = item.get('time');
            var element = document.getElementById(url);

            $(element).find(COUNT_CONTAINER_REF).text(time);
          }
          for(var i = 0; i < entries.length; i++) {
            var url = entries[i];
            var element = document.getElementById(url);
            var countSpan = $(element).find(COUNT_CONTAINER_REF);
            if( countSpan.text() == '') {
              countSpan.text(0);
            }
          }
        })
        .fail(function (object, error) {
          console.log("Error: " + error.code + " " + error.message);
        });
    }

    function addCount(Counter) {
      var $visitors = $(".leancloud_visitors");
      var url = $visitors.attr('id').trim();
      var title = $visitors.attr('data-flag-title').trim();
      var query = new AV.Query(Counter);

      query.equalTo("url", url);
      query.find({
        success: function(results) {
          if (results.length > 0) {
            var counter = results[0];
            counter.fetchWhenSave(true);
            counter.increment("time");
            counter.save(null, {
              success: function(counter) {
                var $element = $(document.getElementById(url));
                $element.find('.leancloud-visitors-count').text(counter.get('time'));
              },
              error: function(counter, error) {
                console.log('Failed to save Visitor num, with error message: ' + error.message);
              }
            });
          } else {
            var newcounter = new Counter();
            /* Set ACL */
            var acl = new AV.ACL();
            acl.setPublicReadAccess(true);
            acl.setPublicWriteAccess(true);
            newcounter.setACL(acl);
            /* End Set ACL */
            newcounter.set("title", title);
            newcounter.set("url", url);
            newcounter.set("time", 1);
            newcounter.save(null, {
              success: function(newcounter) {
                var $element = $(document.getElementById(url));
                $element.find('.leancloud-visitors-count').text(newcounter.get('time'));
              },
              error: function(newcounter, error) {
                console.log('Failed to create');
              }
            });
          }
        },
        error: function(error) {
          console.log('Error:' + error.code + " " + error.message);
        }
      });
    }

    $(function() {
      var Counter = AV.Object.extend("Counter");
      if ($('.leancloud_visitors').length == 1) {
        addCount(Counter);
      } else if ($('.post-title-link').length > 1) {
        showTime(Counter);
      }
    });
  </script>



  

  

  

  

</body>
</html>
